
/**
 * 作者：I-AM-WASTE
 * TIME:2022年10月4日
 */

let v = new Vue({
    el:"#gameDlList",
    data:{
        gameDlList:[],
        pageNum:1,
    },
    created:function (){
        axios.post("/indexgame/"+this.pageNum).then(function (response){
            v.gameDlList = response.data
        })
    },
    methods:{
        page(index){
            axios.post("/indexgame/"+index).then(function (response){
                v.gameDlList = response.data
            })
        },
        yiru(index){
            this.$refs.imgshow[index].style.boxShadow = "0  45px 45px  -35px rgba(0,0,0,0.9)"
            this.$refs.pact[index].style.color = "#e72727"
            this.$refs.masact[index].style.bottom = "-30px"
        },
        yichu(index){
            this.$refs.imgshow[index].style.boxShadow = ""
            this.$refs.pact[index].style.color = ""
            this.$refs.masact[index].style.bottom = ""
        },
        wxandqq(index){
            let host = window.location.host
            console.log(index)
            let title = document.getElementById("name"+index).innerText
            let url = "【暮迟的游戏小屋】  "+title+"  "+"http://"+host+"/gameart/"+index;
            this.copyToClipboard(url)
            v.$Message.success({
                content: "复制成功！快去粘贴吧！",
                duration: 3
            });
        },
        // 点击复制到剪贴板函数
        copyToClipboard(content) {
            if (window.clipboardData) {
                window.clipboardData.setData('text', content);
            } else {
                (function (content) {
                    document.oncopy = function (e) {
                        e.clipboardData.setData('text', content);
                        e.preventDefault();
                        document.oncopy = null;
                    }
                })(content);
                document.execCommand('copy');
            }
        },
    }
})